# 九九乘法表
# for i in range(1, 10):  # 外层循环 控制列
#  第一种方法
#     for j in range(1, 10):
#         if j <= i:
#             print(f"{j} * {i} = {i * j:<2}", end=" ")
#     print() #换行
# 第2种方法
#    for j in range(1, i+1): # 内层循环 控制行
#           print(f"{j} * {i} = {i * j:<2}", end=" ")   # :<左对齐
#     print() #换行


# for 循环实现斐波那契
# def lie_1():
#     n = int(input("请输入一个正整数："))
#     if n <= 0:
#         return []
#     elif n == 1:
#         return 1
#     elif n == 2:
#         return [1,1]
#     fibs = [1, 1]
#     for i  in range(2, n):  # [0,1,2]
#         next_num = fibs[i- 1] + fibs[i - 2] # 索引前两项相加
#         fibs.append(next_num) # 向列表后添加
#     return fibs # 循环
# print(lie_1())

# 素数
# def num_1():
#     n = int(input("请输入一个正整数："))
#     if n <= 1:
#         return False
#     for i in range(2, n):
#         if n % i == 0:
#             return False
#     return True
# def num_2():
#     if num_1():
#         print("是素数")
#     else:
#         print("不是素数")
# num_2()  #(n) 输出(n)  ()输出(空)

# 水仙花数
def num_1():
    for n in range(100, 1000):
        num_b = n // 100
        num_s = n // 10 % 10
        num_g = n % 10
        if n == num_b**3 + num_s**3 + num_g**3:
            print(f"{n}是水仙花数")
    return n
num_1()  # 输出多个数不用print
